package com.leesche.zcsp.node.utils;

import java.util.Map;

public class ConfigKit {
	private static Map<String,String> config;

	public static void setConfig(Map<String, String> config) {
		ConfigKit.config = config;
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static void setConfig(String filePath) {
		ConfigKit.config = (Map)PropKit.use(filePath).getProperties();
	}
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static Map<String,String> getConfig() {
		if(ConfigKit.config == null){
			ConfigKit.config = (Map)PropKit.use("config.txt").getProperties();
		}
		return ConfigKit.config;
	}
	
	public static String get(String key){
		return getConfig().get(key);
	}
}
